<!DOCTYPE html>
<#assign ctx=request.contextPath>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="${ctx}/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/css/style.css" />
    <script type="text/javascript" src="${ctx}/js/jquery.js"></script>
    <script type="text/javascript" src="${ctx}/js/ckform.js"></script>
    <script type="text/javascript" src="${ctx}/js/common.js"></script>

 

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>
<form class="form-inline definewidth m20" action="${ctx}/admin/user/userList" method="post">    
    用户名称：
    <input type="text" name="userId" id="username"class="abc input-default" placeholder="" value="">&nbsp;&nbsp;  
    <button type="submit" class="btn btn-primary">查询</button>
</form>
<table class="table table-bordered table-hover definewidth m10">
    <thead>
    <tr>
        <th>用户编号</th>
        <th>用户名称</th>
        <th>真实姓名</th>
        <th>角色</th>
        <!--  <th>省份</th>-->
        <!--  <th>城市</th> -->
        <th>手机号码</th>
        <th>邮箱</th>
        <th>联系地址</th>
        <th>创建时间</th>
        <th colspan="2" style="text-align:center">操作</th>
    </tr>
    </thead>
         <#if userList??>
         <#list userList as user>
	     <tr>
            <td>${user.id}</td>
            <td>${user.userId}</td>
            <td>
              <#if user.name??>
                 ${user.name}
              <#else>
                 未完善
              </#if>
            </td>
            <td>
            	<#if user.role==1>
            		普通用户
            	<#else>
            		管理员
            	</#if>
            </td>
            <td>${user.phone}</td>
            <td>${user.email}</td>
            <td>
              <#if user.address??>
                 ${user.address}
              <#else>
                 未完善
              </#if>
            </td>
            <td>${user.createDate?string("yyyy-MM-dd")}</td>
            <td>
                  <a href="${ctx}/admin/user/showUpdate?id=${user.id}">修改</a>
            </td>
             <td>
                  <a href="javascript:;" onclick="deleteUser(${user.id})">删除</a>
             </td>
        </tr>
        </#list>
        </#if>	
</table>
<#if pageModel.recordCount??>
		<!-- 分页标签-->
		<div id="pagerInfo" style="margin:5px 0px; 
		text-align:center;background-color:#FFFF00;color:blue">
  		共${pageModel.recordCount}条,
  		分${((pageModel.recordCount+pageModel.pageSize -1)/pageModel.pageSize)?int}页
  		</div>
  	 	<div id="pager">
  		<#import "../common/pager.html" as page>
  		<@page.pager pageIndex=pageModel.pageIndex pageSize=pageModel.pageSize 
  		recordCount=pageModel.recordCount toURL="${ctx}/admin/user/userList"/>
    	</div>
</#if>
</body>
</html>
<script>
    $(function () {
		$('#addnew').click(function(){
				window.location.href="add.html";
		 });
    });
	function del(id)
	{
		if(confirm("确定要删除吗？"))
		{
			var url = "index.html";	
			window.location.href=url;		
		}
	}
</script>